<%@ page import="java.util.Calendar" %><%--
  Created by IntelliJ IDEA.
  User: Think
  Date: 2024/7/22
  Time: 下午10:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>jsp服务器响应</title>
</head>
<body>
<h1>自动刷新实例</h1>
<%
    response.setIntHeader("Refresh",5);
    Calendar calendar = Calendar.getInstance();
    String am_pm;
    int hour = calendar.get(Calendar.HOUR_OF_DAY);
    int minute = calendar.get(Calendar.MINUTE);
    int second = calendar.get(Calendar.SECOND);
    int year = calendar.get(Calendar.YEAR);
    if (calendar.get(Calendar.AM_PM)==0){
        am_pm="AM";
    }else {
        am_pm = "PM";
    }

    String CT =year+" "+ hour+":"+minute+":"+second+" "+am_pm;
    out.println("当前时间"+CT);
%>
</body>
</html>
